
//---------------------------------------------------------------------------
#ifndef CPRecbtoH
#define CPRecbtoH

//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "Cadpad.h"
#include "CGAUGES.h"
#include "PHDS.h"
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include "PHCombo.h"
#include "PHEdit.h"
#include "PHLabel.h"
#include "PHSpdBut.h"
#include "PHMemo.h"
#include "DMRcbto.h"
#include "PHGridEd.h"
#include <Grids.hpp>
#include "Word_2K_SRVR.h"
#include <OleServer.hpp>
#include "Emissao.h"
#include "PHSPDBUT.h"

//---------------------------------------------------------------------------
class TCPRcbto1 : public TCadPad1
{
  __published:  // IDE-managed Components
    PHLabel*  PHLabel1;
    PHEdit*  PHEdit1;
    PHLabel*  PHLabel2;
    PHEdit*  PHEdit2;
    PHLabel*  PHLabel3;
    PHComboBox*  PHComboBox1;
    PHLabel*  PHLabel4;
    PHEdit*  PHEdit3;
    PHEdit*  PHEdit4;
    PHLabel*  PHLabel5;
    PHEdit*  PHEdit5;
    PHLabel*  PHLabel6;
    PHEdit*  PHEdit6;
    PHLabel*  PHLabel7;
    PHEdit*  PHEdit7;
    PHLabel*  PHLabel8;
    PHEdit*  PHEdit8;
    PHLabel*  PHLabel9;
    PHEdit*  PHEdit9;
    PHLabel*  PHLabel10;
    PHEdit*  PHEdit10;
    PHLabel*  PHLabel11;
    PHEdit*  PHEdit11;
    PHLabel*  PHLabel12;
    PHEdit*  PHEdit12;
    PHLabel*  PHLabel13;
    PHEdit*  PHEdit13;
    PHLabel*  PHLabel14;
    PHEdit*  PHEdit14;
    PHLabel*  PHLabel15;
    PHEdit*  PHEdit15;
    PHSpeedButton*  PHSpeedButton2;
    PHEdit*  PHEdit16;
    PHEdit*  PHEdit17;
    PHEdit*  PHEdit18;
    PHLabel*  PHLabel16;
    PHComboBox*  PHComboBox2;
    PHLabel*  PHLabel17;
    PHEdit*  PHEdit19;
    PHLabel*  PHLabel18;
    PHEdit*  PHEdit20;
    PHLabel*  PHLabel19;
    PHMemo*  PHMemo1;
    TLabel*  Label1;
    PHGridEdit*  PHGridEdit1;
    PHDataSource*  DS1;
    TSpeedButton*  SpeedButton22;
    TBitBtn*  BitBtn2;
    PHLabel*  PHLabel20;
    PHEdit*  PHEdit21;
    TSpeedButton*  SpeedButton23;
    PHLabel*  PHLabel21;
    PHEdit*  PHEdit22;
    TSpeedButton*  SpeedButton24;
    TWordApplication*  W1;
    TWordDocument*  WD1;
    TLabel *Label2;
    PHLabel *PHLabel22;
    PHEdit *PHEdit23;
    PHLabel *PHLabel23;
    PHEdit *PHEdit24;
    PHLabel *PHLabel24;
    TEdit *CreditoAnterior;
    TLabel *Label3;
    PHLabel *PHLabel27;
    PHEdit *PHEdit26;
    TSpeedButton *SpeedButton25;
    void __fastcall FormDestroy( TObject* Sender );
    void __fastcall FormShow( TObject* Sender );
    void __fastcall PHDS1AfterOpen( TObject* Sender );
    void __fastcall PHDS1BeforePost( TObject* Sender );
    void __fastcall PHDS1AfterInsert( TObject* Sender );
    void __fastcall PHDS1AfterRead( TObject* Sender );
    void __fastcall PHComboBox1Change( TObject* Sender );
    void __fastcall PHEdit15Change( TObject* Sender );
    void __fastcall PHComboBox2Change( TObject* Sender );
    void __fastcall DS1BeforePost( TObject* Sender );
    void __fastcall DS1BeforeInsert( TObject* Sender );
    void __fastcall PHDS1BeforeDelete( TObject* Sender );
    void __fastcall PHDS1BeforeCancel( TObject* Sender );
    void __fastcall SpeedButton22Click( TObject* Sender );
    void __fastcall PHDS1StateChange( Estados State );
    void __fastcall BitBtn2Click( TObject* Sender );
    void __fastcall DS1BeforeDelete( TObject* Sender );
    void __fastcall PHEdit21Change( TObject* Sender );
    void __fastcall PHEdit9Enter( TObject* Sender );
    void __fastcall PHEdit9Exit( TObject* Sender );
    void __fastcall PHEdit12Enter( TObject* Sender );
    void __fastcall PHEdit13Enter( TObject* Sender );
    void __fastcall PHEdit12Exit( TObject* Sender );
    void __fastcall PHEdit13Exit( TObject* Sender );
    void __fastcall PHEdit3Change( TObject* Sender );
    void __fastcall SpeedButton24Click( TObject* Sender );
    void __fastcall PHEdit9KeyDown( TObject* Sender, WORD& Key, TShiftState Shift );
    void __fastcall PHEdit12KeyDown( TObject* Sender, WORD& Key, TShiftState Shift );
    void __fastcall PHEdit13KeyDown( TObject* Sender, WORD& Key, TShiftState Shift );
    void __fastcall SpeedButton23Click( TObject* Sender );
    void __fastcall W1Quit( TObject* Sender );
    void __fastcall DS1AfterRead( TObject* Sender );
    void __fastcall PHDS1BeforeInsert( TObject* Sender );
    void __fastcall PHEdit14Change(TObject *Sender);
    void __fastcall PHDS1AfterPost(TObject *Sender);
    void __fastcall PHEdit24Exit(TObject *Sender);
    void __fastcall PHEdit23Exit(TObject *Sender);
    void __fastcall PHEdit26Enter(TObject *Sender);
    void __fastcall PHEdit26Exit(TObject *Sender);
    void __fastcall PHEdit26KeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
    void __fastcall SpeedButton25Click(TObject *Sender);

  private:  // User declarations
    void __fastcall HabilitaCampos( void );
    void __fastcall SetCreditoAnterior(double Valor);
    void __fastcall VerificaPagamentosAbertos(AnsiString Cliente);
    void __fastcall MostraExcecoes(void);
    void __fastcall Busca_Recebimentos_Pendentes(TObject *Sender);
    PHDataSource* DSEmp;
    PHDataSource* DSCli;
    PHDataSource* DSRecEmi;
    int registro;
    int CodLanAlterar;
    int CodLanAlterarCheque;
    double ValorCreditoAnterior;
    struct RCBTO* Rc;
    struct RCBTO* Rcbto;
    TEmissao *Emissao;
    TStringList *ListaExcecoes;


  public:  // User declarations
    __fastcall TCPRcbto1( TComponent* Owner );
    void __fastcall VerificaTotalCheques( void );
    int Flag;
    int DataEmissao;

};

//---------------------------------------------------------------------------
extern PACKAGE TCPRcbto1*  CPRcbto1;
extern PACKAGE TCPRcbto1*  CPRcbto2;

//---------------------------------------------------------------------------
#endif


